package be.djdb.game.players;

import java.awt.Image;

import javax.swing.ImageIcon;

import be.djdb.game.essetials.Direction;
import be.djdb.game.essetials.Skins;

public class Hunterskin implements Skins{
	   private  Image up[] ;
	   private  int maxup;
	   private  Image down[] ;
	   private  int maxdown;
	   private  Image left[] ;
	   private  int maxleft;
	   private  Image right[] ;
	   private  int maxright;
	   private  Image defaultskin = new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunter.gif")).getImage();
	   private int imgposition;
	   public Hunterskin() {
			up =  getimgup();
			down = getimgdown();
			left = getimgleft();
			right = getimgright();
			maxup = up.length-1;//var for speed (-cal)
			maxdown = down.length-1;
			maxleft = left.length-1;
			maxright = right.length-1;
	   }
		public Image getfaceimage(Direction direction){
			if (imgposition<0||0>checkpos(direction)){
				imgposition = checkpos(direction);
			}
			switch (direction) {
			case UP:
				return up[imgposition];
			case DOWN:
				return down[imgposition];
			case LEFT:
				return left[imgposition];
			case RIGHT:
				return right[imgposition];
			default:
				return defaultskin;
			}
		}
	    private Image[] getimgup(){
	    	return new Image[] {
	    			new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterU1.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterU2.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterU3.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterU4.gif")).getImage(),
			};
	    }
	    private Image[] getimgdown(){
	    	return new Image[] {
	    			new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterD1.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterD2.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterD3.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterD4.gif")).getImage(),
			};
	    }
	    private Image[] getimgleft(){
	    	return new Image[] {
	    			new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterL1.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterL2.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterL3.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterL4.gif")).getImage(),
			};
	    }
	    private Image[] getimgright(){
	    	return new Image[] {
	    			new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterR1.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterR2.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterR3.gif")).getImage(),
	    	        new ImageIcon(Hunterskin.class.getResource("/images/DefaultSkin/Hunterskin/hunterR4.gif")).getImage(),
			};
	    }

		public int checkpos(Direction direction) {
			switch (direction) {
			case UP:
				return maxup;
			case DOWN:
				return maxdown;
			case LEFT:
				return maxleft;
			case RIGHT:
				return maxright;
			default:
				return 0;
			}
		}
		@Override
		public void animate() {
			imgposition--;	
		}


}
